<?php echo $this->Html->script('cart'); ?>

<div class="contentMain">
	<div class="grayBox">
		<div class="pagination">
			<div class="paging">

				<?php 
				if(!$this->Paginator->first()){
				?>
				<span class="arrowBg grayPrevFirst" href="#"></span>
				<?
				}
				echo $this->Paginator->first('<span class="arrowBg yellowPrevFirst"></span>', array('escape'=>false));
										
				if($this->Paginator->hasPrev()){
					echo $this->Paginator->prev('<span class="arrowBg yellowPrev"></span>', array('escape'=>false));
				}
				else{
					echo $this->Paginator->prev('<span class="arrowBg grayPrev"></span>', array('escape'=>false));
				}
				?>
				<?php echo $this->Paginator->numbers(array('first'=>1,'modulus'=>4, 'last'=>1));?>
				<?php 
					if($this->Paginator->hasNext()){
					
						echo $this->Paginator->next('<span class="arrowBg yellowNext"></span>', array('escape'=>false));
					}
					else{
						echo $this->Paginator->next('<span class="arrowBg grayNext"></span>', array('escape'=>false));
					}
				if(!$this->Paginator->last()){
				?>
				<span class="arrowBg grayNextFirst"></span>
				<?
				}		
					echo $this->Paginator->last('<span class="arrowBg yellowNextFirst"></span>', array('escape'=>false));
				?>
			</div>
		</div>

		<div class="articleList">
			<ul>
			<?foreach($deals as $deal):?>
				<li>
					<div class="rightCol">
						<div>
							<?=$html->image($thumb->image($deal['User']['avatar'],60));?>
						</div>
						<a href="<?=$this->webroot.'products/view/'.$deal['Product']['id']?>" class="title"><?=$deal['Product']['name']?></a>
						<div>Price: <?=$deal['Deal']['price']?></div>
						<div class="infoBar">
							on <?php echo date(COMMON_DATE_FORMAT, strtotime($deal['Product']['modified']));?> | 
							by <?php echo $html->link($deal['User']['name'], '/users/view/' . $deal['User']['id']) ?>
						</div>
						<?=$deal['Deal']['description']?>
						<a href="javascript:void(0)" class="add_to_cart"><span id="<?=$deal['Deal']['id']?>_add" <?php if ($deal['InCart']) echo "style='display:none'"?> >Add to cart</span></a>
						<a href="javascript:void(0)" class="remove_from_cart"><span id="<?=$deal['Deal']['id']?>_remove" <?php if (!$deal['InCart']) echo "style='display:none'"?> >Remove from cart</span></a>
						<?php if (!$deal['InCart']) { ?>
						<?php } else { ?>
						<?php } ?>
					</div>
				</li>
				<?endforeach;?>
			</ul>		
		</div>
		
		<div class="pagination">
			<div class="paging">
				<?php 
				if(!$this->Paginator->first()){
				?>
				<span class="arrowBg grayPrevFirst" href="#"></span>
				<?
				}
				echo $this->Paginator->first('<span class="arrowBg yellowPrevFirst"></span>', array('escape'=>false));
										
				if($this->Paginator->hasPrev()){
					echo $this->Paginator->prev('<span class="arrowBg yellowPrev"></span>', array('escape'=>false));
				}
				else{
					echo $this->Paginator->prev('<span class="arrowBg grayPrev"></span>', array('escape'=>false));
				}
				?>
				<?php echo $this->Paginator->numbers(array('first'=>1,'modulus'=>4, 'last'=>1));?>
				<?php 
					if($this->Paginator->hasNext()){
					
						echo $this->Paginator->next('<span class="arrowBg yellowNext"></span>', array('escape'=>false));
					}
					else{
						echo $this->Paginator->next('<span class="arrowBg grayNext"></span>', array('escape'=>false));
					}
				if(!$this->Paginator->last()){
				?>
				<span class="arrowBg grayNextFirst"></span>
				<?
				}		
					echo $this->Paginator->last('<span class="arrowBg yellowNextFirst"></span>', array('escape'=>false));
				?>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
